/**
 * 
 */
package infomanager;

import info.Teacher;

/**
 * @author vtkhanh
 * 
 */
public class TeacherManager {
    private static Teacher[] sTeachers;
    private static int sTeacherNum = 0;
    private static int sCount = 0;

    public static Teacher[] getTeachers() {
	if (sTeachers == null) {
	    sTeachers = new Teacher[sTeacherNum];
	}
	return sTeachers;
    }

    public static Teacher getTeacherById(int id) {
	for (Teacher teacher : sTeachers) {
	    if (teacher.getTeacherId() == id) {
		return teacher;
	    }
	}
	return null;
    }
    
    public static void addTeacher(Teacher teacher) {
	if (sCount < sTeacherNum) {
	    sTeachers[sCount] = teacher;
	    sCount++;
	}
    }
    
    public static void setTeachers(Teacher[] teachers) {
	TeacherManager.sTeachers = teachers;
    }

    public static void setNumberOfTeachers(int num) {
	sTeacherNum = num;
    }
    
    public static int getNumberOfTeachers() {
	return sTeacherNum;
    }
}
